const webdriver = require('selenium-webdriver');
const args = process.argv.splice(2)

const username = args[0]
const password = args[1]
const station = args[2]

const driver = new webdriver.Builder()
  .usingServer(`http://localhost:9515`)
  .withCapabilities({
    chromeOptions: {
      binary:__dirname+'\\..\\st\\App\\STO.WuTong.exe',
    }
  })
  .forBrowser('chrome')
  .build();

driver.wait(function() {
  driver.findElement(webdriver.By.id('userName')).sendKeys(username||"");
  driver.findElement(webdriver.By.id('userPass')).sendKeys(password||"");
  driver.findElement(webdriver.By.id('siteCode')).sendKeys(station||"");
  return true;
}, 20000);

console.log("over");